#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File    :   bk_views.py    

@Modify Time      @Author    @Version    @Desciption
------------      -------    --------    -----------
2020/6/6 14:45   chenlin      1.0         None
"""
from blueapps.utils import get_client_by_user
from config import APP_CODE, SECRET_KEY


def search_business():
    client = get_client_by_user('chenlin')
    info = client.cc.search_business({
        'bk_app_code': APP_CODE,
        'bk_app_secret': SECRET_KEY
    })
    return info


def get_job_list(bk_biz_id):
    client = get_client_by_user('chenlin')
    info = client.job.get_job_list({
        'bk_app_code': APP_CODE,
        'bk_app_secret': SECRET_KEY,
        'bk_biz_id': bk_biz_id
    })
    return info


def get_job_detail(bk_biz_id, bk_job_id):
    client = get_client_by_user('chenlin')
    info = client.job.get_job_detail({
        'bk_app_code': APP_CODE,
        'bk_app_secret': SECRET_KEY,
        'bk_biz_id': bk_biz_id,
        "bk_job_id": bk_job_id
    })
    return info
